﻿using Fozzy;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Microsoft.FamilyShowLib
{
    public class Family2                                     : Name
    {
        #region Declarations
            //public string       appLocation                 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), App.ApplicationFolderName)    ;
            public string       appLocation                 = "";
        #endregion

        #region States
            //string.IsNullOrEmpty(familyCollection.FullyQualifiedFilename) || family.IsOldVersion
            public bool         Be_Named                    { get { return this.Exist(Name)                                                 ; } }
            public bool         Be_Old                      { get ; set                                                                     ; }
            public bool         Be_Dirty                    { get ; set                                                                     ; }
            public bool         Ends_With(string rec)       { return Name.Ends_With(rec)                                                    ; }
            //                if (familyCollection.FullyQualifiedFilename.EndsWith(Properties.Resources.DefaultFamilyExtension))

        #endregion

        #region Properties
            public Fozzy.Directory          Directory       { get { return new Fozzy.Directory(appLocation)                             ; } }
            public Name                     Name            { get { return Directory.Extend(base.Name)                                  ; } }

        #endregion
    
        #region Constructeur
            public Family2(string name)                      : base(name)
            { }

        #endregion

            public void Re_Set()
            {
                //family.Clear();
                //familyCollection.FullyQualifiedFilename = null;
                //family.OnContentChanged();
                //family.IsDirty = false;
                //Clear()                                     ;
                Reset_Name()                                ;   
                Cleanse()                                   ;
                On_Change()                                 ;
            }

            public void Reset_Name()
            {
                Set(string.Empty)                           ;
            }

            public void Cleanse()
            {
                Be_Dirty = false                            ;
            }

            public void Dirtise()
            {
                Be_Dirty = true                             ;
            }

            public void On_Change()
            { }

            public void Re_Name(string rec)
            {
                Re_Set()                                    ;
                Set(rec)                                    ;
            }
    }
}
